from appium.webdriver.common.mobileby import MobileBy

from app_first_pratice.base_page import BasePage


class EditorMemberPage(BasePage):
    def add_member_success(self,name,phonenum,address):
        # 输入姓名
        self.find(MobileBy.XPATH,"//*[@text='必填']").send_keys(name)
        # 输入手机号
        self.find(MobileBy.XPATH,"//*[@text='手机号']").send_keys(phonenum)
        # 添加地址
        self.find(MobileBy.XPATH,"//*[@text='地址']/../android.widget.RelativeLayout").click()
        self.find(MobileBy.XPATH, "//*[@resource-id='com.tencent.wework:id/gz']").send_keys(address)
        self.find(MobileBy.XPATH, "//*[@text='确定']").click()
        # 点击保存
        self.find(MobileBy.XPATH,"//*[@text='保存']").click()
        # 获取toast提示
        # toast_message = self.find(MobileBy.XPATH,"//*[contains(@text,'添加成功')]").text
        # toast_message = self.get_toast_message()
        from app_first_pratice.addmember_page import AddMemberPage
        return AddMemberPage()

    def add_member_fail(self):
        pass